FROM node:16.15.0
# 创建容器内的项目存放目录
RUN mkdir -p /home/nodeapp
WORKDIR /home/nodeapp
COPY . /home/nodeapp
RUN cd /home/nodeapp 
RUN chmod -R 777 *
# 全局安装cnpm
#RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
# 全局安装yarn
#RUN npm install -g yarn --registry=https://registry.npm.taobao.org
RUN yarn install
RUN yarn build
RUN ls -l -a
# 容器对外暴露的端口号，要和node项目配置的端口号一致
EXPOSE 8091
# 容器启动时执行的命令
CMD ["sh", "-c", "yarn start"]
